package me.wlz.rest;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import me.wlz.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/user")
@Api(tags = "用户信息管理-API-接口文档")
public class UserController {

    @GetMapping("/list")
    @ApiOperation(value = "查询用户列表（Test）", notes = "查询用户的所有数据（Test）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id号",required = false, dataType = "Long"),
            @ApiImplicitParam(name = "name", value = "名称",required = false, dataType = "String")
    })
    public List<User> queryList(@RequestParam(value = "id", required = false) Long id,
                                @RequestParam(value = "name", required = false) String name) {

        User user = new User();
        List<User> users = new ArrayList<>();

        user.setId(1998L);
        user.setName("我是用户（Test）");
        user.setAge(18);
        user.setSex("男");

        users.add(user);

        return users;
    }

}
